package tree.leetcode_226_easy;

public class InvertTree {
    //先序
    public TreeNode invertTree(TreeNode root){
        if(root == null){
            return null;
        }
        //翻转
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;
        //对左、右递归进行翻转
        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
